package com.drinks.yiniang.adapter.listview;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.drinks.yiniang.R;
import com.drinks.yiniang.entity.user.order.OrderEvaluateJson;
import com.hansen.library.ui.widget.ratingbar.CustomRatingBar;
import com.hansen.library.utils.CommonUtils;

import java.util.List;

/**
 * 评论维度star adapter
 *
 * Created by han on 2019/6/27 0027.
 */

public class DimensionAdapter extends BaseAdapter {
    private Context mContext;

    private List<OrderEvaluateJson.OrderEvaluateRadar> mList;

    private LayoutInflater inflater;

    public DimensionAdapter(Context mContext, List<OrderEvaluateJson.OrderEvaluateRadar> mList) {
        this.mContext = mContext;
        this.mList = mList;

        inflater = LayoutInflater.from(mContext);
    }

    @Override
    public int getCount() {
        return CommonUtils.getListSize(mList);
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder mHolder = null;

        if (convertView == null) {
            mHolder = new ViewHolder();

            convertView = inflater.inflate(R.layout.item_comments_dimension, null);

            mHolder.tv_comments_dimension_name = convertView.findViewById(R.id.tv_comments_dimension_name);
            mHolder.rating_comments_dimension_star = convertView.findViewById(R.id.rating_comments_dimension_star);

            convertView.setTag(mHolder);
        } else {
            mHolder = (ViewHolder) convertView.getTag();
        }


        return convertView;
    }

    class ViewHolder {
        //维度名称
        TextView tv_comments_dimension_name;
        //星级
        CustomRatingBar rating_comments_dimension_star;
    }
}
